﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPFByCoreApp
{
    public class TestPrecision
    {
        public void test()
        {
            string str = (400 * 1000).ToString();

            decimal a = (decimal)8.5123456789 * 1000 * 1000 * 1000;
            double b = (double)a;
            decimal c = (decimal)b;
            float f = (float)a;

            byte[] bytes = Encoding.UTF8.GetBytes(f.ToString());
            bytes = BitConverter.GetBytes(f);

            f = BitConverter.ToSingle(bytes, 0);
            c = (decimal)f;
            //b = double.Parse(Encoding.UTF8.GetString(bytes));
            //c = (decimal)b;
            //int d = (int)double.Parse(Encoding.UTF8.GetString(bytes));

            //double d = 500;
            //double d1 = 233.84;
            //double d2 = d - d1;

            //d = 0.4;
            //d1 = d + d + d;
            ////d1=1.2000000000000002
            //d2 = d * 3;


            //d = 1.2;
            //d1 = d / 0.4;

            decimal d = 500m;
            decimal d1 = 233.84m;
            decimal d2 = d - d1;

            d = 0.4m;
            d1 = d + d + d;
            //d1=1.2000000000000002
            d2 = d * 3;


            d = 1.2m;
            d1 = d / 0.4m;
        }
    }
}
